package com.study.demo.greendao;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.study.demo.db.ReadThread;
import com.study.demo.db.User;
import com.study.demo.db.ThreadReply;
import com.study.demo.db.ThreadInfo;
import com.study.demo.db.ImageCache;
import com.study.demo.db.Forum;
import com.study.demo.db.CustomThread;

import com.study.demo.greendao.ReadThreadDao;
import com.study.demo.greendao.UserDao;
import com.study.demo.greendao.ThreadReplyDao;
import com.study.demo.greendao.ThreadInfoDao;
import com.study.demo.greendao.ImageCacheDao;
import com.study.demo.greendao.ForumDao;
import com.study.demo.greendao.CustomThreadDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig readThreadDaoConfig;
    private final DaoConfig userDaoConfig;
    private final DaoConfig threadReplyDaoConfig;
    private final DaoConfig threadInfoDaoConfig;
    private final DaoConfig imageCacheDaoConfig;
    private final DaoConfig forumDaoConfig;
    private final DaoConfig customThreadDaoConfig;

    private final ReadThreadDao readThreadDao;
    private final UserDao userDao;
    private final ThreadReplyDao threadReplyDao;
    private final ThreadInfoDao threadInfoDao;
    private final ImageCacheDao imageCacheDao;
    private final ForumDao forumDao;
    private final CustomThreadDao customThreadDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        readThreadDaoConfig = daoConfigMap.get(ReadThreadDao.class).clone();
        readThreadDaoConfig.initIdentityScope(type);

        userDaoConfig = daoConfigMap.get(UserDao.class).clone();
        userDaoConfig.initIdentityScope(type);

        threadReplyDaoConfig = daoConfigMap.get(ThreadReplyDao.class).clone();
        threadReplyDaoConfig.initIdentityScope(type);

        threadInfoDaoConfig = daoConfigMap.get(ThreadInfoDao.class).clone();
        threadInfoDaoConfig.initIdentityScope(type);

        imageCacheDaoConfig = daoConfigMap.get(ImageCacheDao.class).clone();
        imageCacheDaoConfig.initIdentityScope(type);

        forumDaoConfig = daoConfigMap.get(ForumDao.class).clone();
        forumDaoConfig.initIdentityScope(type);

        customThreadDaoConfig = daoConfigMap.get(CustomThreadDao.class).clone();
        customThreadDaoConfig.initIdentityScope(type);

        readThreadDao = new ReadThreadDao(readThreadDaoConfig, this);
        userDao = new UserDao(userDaoConfig, this);
        threadReplyDao = new ThreadReplyDao(threadReplyDaoConfig, this);
        threadInfoDao = new ThreadInfoDao(threadInfoDaoConfig, this);
        imageCacheDao = new ImageCacheDao(imageCacheDaoConfig, this);
        forumDao = new ForumDao(forumDaoConfig, this);
        customThreadDao = new CustomThreadDao(customThreadDaoConfig, this);

        registerDao(ReadThread.class, readThreadDao);
        registerDao(User.class, userDao);
        registerDao(ThreadReply.class, threadReplyDao);
        registerDao(ThreadInfo.class, threadInfoDao);
        registerDao(ImageCache.class, imageCacheDao);
        registerDao(Forum.class, forumDao);
        registerDao(CustomThread.class, customThreadDao);
    }
    
    public void clear() {
        readThreadDaoConfig.clearIdentityScope();
        userDaoConfig.clearIdentityScope();
        threadReplyDaoConfig.clearIdentityScope();
        threadInfoDaoConfig.clearIdentityScope();
        imageCacheDaoConfig.clearIdentityScope();
        forumDaoConfig.clearIdentityScope();
        customThreadDaoConfig.clearIdentityScope();
    }

    public ReadThreadDao getReadThreadDao() {
        return readThreadDao;
    }

    public UserDao getUserDao() {
        return userDao;
    }

    public ThreadReplyDao getThreadReplyDao() {
        return threadReplyDao;
    }

    public ThreadInfoDao getThreadInfoDao() {
        return threadInfoDao;
    }

    public ImageCacheDao getImageCacheDao() {
        return imageCacheDao;
    }

    public ForumDao getForumDao() {
        return forumDao;
    }

    public CustomThreadDao getCustomThreadDao() {
        return customThreadDao;
    }

}
